Skip to content

feat(ws): send graceful close frame to WebSocket clients on server shutdown (#347) - #536

Open
sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/ws-graceful-close-frame-347
Open

sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/ws-graceful-close-frame-347

Conversation

@sparkysolutions10-pixel

Copy link
Copy Markdown
Contributor

Closes #347

Summary of Changes

  • Implements graceful shutdown in FanOutManager.destroy() by sending active WebSocket clients a clean close frame with code 1001 ("Server shutting down") instead of abrupt TCP drop.
  • Provides a configurable flush window (flushWindowMs) allowing in-flight price updates to drain cleanly before terminating connections.
  • Ensures destroy() is re-entrant and idempotent, preventing mid-fanout iteration exceptions.
  • Added automated unit tests in src/__tests__/fanout.test.ts.

@sparkysolutions10-pixel
sparkysolutions10-pixel force-pushed the feat/ws-graceful-close-frame-347 branch from 43f3d62 to a55079b Compare October 19, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Websocket clients are dropped without a close frame on shutdown

1 participant